package edu.pg.ipse.kb.frame.core;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 *
 */
public class Frame {

    private int id;
    private String name;
    private String descr = "Desription";
    private List<Slot> slots = new ArrayList<Slot>();

    private IFrameAccessObject frameAccessObject;

    public Frame(int id, String name) {
        this.id = id;
        this.name = name;
    }

    /**
     * NOTE: Only "AND" behaviour is implemented
     * 
     * @return
     */
    public ResultType test() {
 
        for (Slot slot : slots) {
            ResultType result = slot.test();

            if(result == ResultType.NO) {
                return ResultType.NO;
            }
            else if(result == ResultType.DO_NOT_KNOW) {
                return ResultType.DO_NOT_KNOW;
            } else {
                continue;
            }
        }

        return ResultType.YES;
    }

    public void addSlot(Slot slot) {

        if(!slots.contains(slot)) {
            slot.setFrame(this);
            slots.add(slot);
        }
    }

    // getters and setters

    public String getDescr() {
        return descr;
    }

    public void setDescr(String descr) {
        this.descr = descr;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public List<Slot> getSlots() {
        return slots;
    }

    public void setSlots(List<Slot> slots) {
        this.slots = slots;
    }

    public IFrameAccessObject getFrameAccessObject() {
        return frameAccessObject;
    }

    public void setFrameAccessObject(IFrameAccessObject frameAccessObject) {
        this.frameAccessObject = frameAccessObject;
    }


    
}
